package org.vaadin.golfscoretracker.ui.views;

import org.vaadin.appfoundation.i18n.Lang;
import org.vaadin.golfscoretracker.data.Player;
import org.vaadin.golfscoretracker.ui.components.PlayerFieldFactory;
import org.vaadin.golfscoretracker.ui.controller.PlayerController;

import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.ui.FormFieldFactory;
import com.vaadin.ui.Button.ClickListener;

public class PlayersView extends AbstractDataEditorView<Player> implements
        ClickListener, ValueChangeListener {

    private static final long serialVersionUID = 5636350802177564945L;

    public PlayersView() {
        super(new PlayerController());
    }

    @Override
    protected FormFieldFactory getFormFieldFactory() {
        return new PlayerFieldFactory();
    }

    @Override
    protected Object[] getVisibleItemProperties() {
        return new Object[] { "name" };
    }

    @Override
    protected void setTableHeaders() {
        table.setColumnHeader("name", Lang.getMessage("player name"));
    }

}
